package ks.client.controllers.game;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import org.w3c.dom.Document;

import ks.client.UserContext;
import ks.client.ipc.Client;
import ks.client.lobby.Lobby;
import ks.framework.common.Message;
/**
 * Sends reject command to server
 * @author szutshi
 *
 */
public class RejectPlayerController implements ActionListener{
	Lobby lobby;
	
	public RejectPlayerController(Lobby lobby){
		this.lobby = lobby;
	}

	public void actionPerformed(ActionEvent e) {
		//create request
		String s = 	"<command version=\"1.0\" id=\"589a39591271844e3fbe32bbb9281ad9\">"
					+ "<reject table=\"100\" player=\"someone\" />" 
					+ "</command>";
		Document d = Message.construct(s);
		Message m = new Message(d);
		
		//send to server
		UserContext uc = lobby.getUserContext();
		Client c = uc.getClient();
		c.sendToServer(m);
		
	}

}

